package com.utopia.android.catcher.demo

import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity

class TestActivity: AppCompatActivity(){

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(TextView(this).apply {
            text = "测试审时度势的是"
        })
        Thread.sleep(2 * 1000)
    }

    override fun onResume() {
        super.onResume()
        Handler(Looper.getMainLooper()).postDelayed(Runnable {
            val threshold = 9 * 1000
            val start = System.currentTimeMillis()
            while (true) {
                if (System.currentTimeMillis() - start >= threshold) {
                    break
                }
            }
        }, 2 * 1000)
    }
}